package com.newtouch.avmarketing.api.util;

import com.newtouch.avmarketing.mgr.modules.avmarkrting.entity.DoubleConfiguration;
import com.newtouch.avmarketing.mgr.modules.avmarkrting.service.DoubleConfigurationService;
import com.newtouch.avmarketing.mgr.modules.avmarkrting.service.ReadService;
import com.newtouch.avmarketing.mgr.modules.avmarkrting.service.SoundService;
import javazoom.jl.decoder.JavaLayerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

import java.io.FileNotFoundException;


public class IndexUtil {

    @Autowired
    private DoubleConfigurationService doubleConfigurationService;
    @Autowired
    private SoundService soundService;
    @Autowired
    private ReadService readService;
    @Value("${tiwen_path}")
    private String tiwenPath;

    public static void main(String[] args) {
        String str = "清楚/不清楚";
        String[] split1 = str.split("/");
        String a = split1[0];
        String b = split1[1];
        System.out.println("a:" + a);
        System.out.println("b:" + b);
    }

    public boolean index(Long id,String content) throws FileNotFoundException, JavaLayerException {
        DoubleConfiguration str = doubleConfigurationService.findByIds(id);
        String string = str.getSbContent();
        String[] strings = string.split("/");
        String suffix = strings[0];
//        if ("a".equals(status)){
//            //
//            readService.textToSpeech(doubleConfiguration);
//            if (!StringUtils.isEmpty(content) && suffix.equals(content)){
//                return true;
//            }else{
//                soundService.playSound(new File(tiwenPath));
//                return false;
//            }
//        }
        return true;
    }
}
